package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Account  string `gorm:"type:varchar(50);not null;commit:'账号'"`
	Password string `gorm:"type:char(32);not null;commit:'密码'"`
	Phone    string `gorm:"type:char(11);unique;not null;commit:'手机号码'"`
	Image    string `gorm:"type:varchar(100);not null;commit:'图片'"`
	NickName string `gorm:"type:varchar(50);not null;commit:'昵称'"`
	StatusId int64  `gorm:"type:int;not null;default:0;commit:'手机号状态:0-正常,1-异常'"`
}

func (u *User) Update() error {
	return DB.Updates(&u).Error
}
func (u *User) List() error {
	return DB.Where("status_id=0").First(&u).Error
}
